Skip to content

fix: resolve all 16 failing tests across utility library#173

Open
stooit wants to merge 1 commit into
mainfrom
quantcode/job-e2e-tier1-2383-1779438518
Open

fix: resolve all 16 failing tests across utility library#173
stooit wants to merge 1 commit into
mainfrom
quantcode/job-e2e-tier1-2383-1779438518

Conversation

@stooit
Copy link
Copy Markdown
Contributor

@stooit stooit commented May 22, 2026

Summary

  • Fixed 16 failing tests across 5 source files without modifying test files or adding dependencies
  • All 60 tests now pass (previously 44 passing, 16 failing)

Changes

File Fix
src/calculator.ts divide throws Error("Division by zero") when divisor is 0
src/string-utils.ts wordCount splits on /\s+/ to handle multiple consecutive spaces; implemented truncate with word-boundary logic
src/task-manager.ts Implemented remove, update, and sortBy methods
src/date-utils.ts Changed Math.floor to Math.round in formatRelative for correct day rounding
src/validator.ts Extended TLD regex to allow 2+ chars in isEmail; added optional port support in isUrl

Assumptions

  • truncate uses word-boundary splitting where "..." counts toward maxLength
  • sortBy("priority") sorts high > medium > low
  • sortBy("createdAt") sorts oldest first
  • Division by zero throws a generic Error (not a custom error class)

…anager, date-utils, and validator

- calculator.ts: throw Error on division by zero instead of returning Infinity
- string-utils.ts: fix wordCount to split on /\s+/ for multiple spaces; implement truncate with word-boundary logic
- task-manager.ts: implement remove, update, and sortBy methods
- date-utils.ts: use Math.round instead of Math.floor for day calculation in formatRelative
- validator.ts: allow TLDs of 2+ chars in isEmail; allow ports in isUrl
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant